﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 位置区域管理
/// </summary>
[Route("QHSEPosition/[action]")]
[ApiController]

public class QHSEPositionController : ControllerBase
{
    private readonly QHSEPositionService _positionService;

    public QHSEPositionController(QHSEPositionService positionService)
    {
        _positionService = positionService;
    }
    /// <summary>
    /// 违章岗位列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSEPositionModel> menus = await _positionService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSEPositionModel> menus = await _positionService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 违章岗位查询
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> Page([FromQuery] QHSEPositionPageInputModel model)
    {
        PageResultModel<QHSEPositionModel> data = await _positionService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> Page1([FromQuery] QHSEPositionPageInputModel model)
    {
        PageResultModel<QHSEPositionModel> data = await _positionService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
}
